<template>
  <section class="contentCon">
      <el-row>
        <el-col :span="24"><div class="grid-content bg-purple-dark"><span style="line-height: 36px;">设备详情</span></div></el-col>
      </el-row>
      <el-tabs type="border-card" v-model="activeCard">
        <el-tab-pane label="设备状态" name="deviceTotal">
            <div class="prod-top">
               <div class="prod-detail-content">
                    <p class="title center">设备ID</p>
                    <p class="prod-content center" style="word-break: break-word;">ST_123124231</p>
               </div>
               <div class="prod-key-content">
                    <p class="title center">设备名称</p>
                    <p class="prod-content center" style="word-break: break-word;">我的ahead</p>
               </div>
                <div class="prod-create-time-content">
                    <p class="title center">绑定用户</p>
                    <p class="prod-content center">用户名</p>
               </div>
                <div class="prod-protocol-content">
                    <p class="title center">设备在线</p>
                    <p class="prod-content center">在线</p>
               </div>
               <div class="clear"></div> 
          </div>
          <div style="padding: 15px;margin-top: 39px;">设备影子</div>
          <el-table
                :data="tableData"
                stripe
                style="width: 100%">
                <el-table-column
                prop="dev_property"
                label="设备属性"
                width="180">
                </el-table-column>
                <el-table-column
                prop="value"
                label="值"
                width="180">
                </el-table-column>
                <el-table-column
                prop="time"
                label="时间" :formatter="formatTime">
                </el-table-column>
            </el-table>
          <div class="clear"></div>
        </el-tab-pane>
        <el-tab-pane label="设备日志" name="deviceLog">
        </el-tab-pane>
        <el-tab-pane label="命令记录" name="appLog">
        </el-tab-pane>
        <el-tab-pane label="调试" name="debugging">
          <device-debug />
        </el-tab-pane> 
      </el-tabs>
  </section>
  </template>
<script type="text/ecmascript-6">
import utils from '@/utils.js';
import deviceDebug from '@/views/device/deviceDebug';
export default {
  data () {
    var date = new Date(new Date().toLocaleDateString());
    return {
        activeCard : null,
        tableData: [{
          dev_property: 'vol',
          value: 123,
          time: date
        }, {
          dev_property: 'cur',
          value: 432,
          time: date
        }, {
          dev_property: 'name',
          value: '客厅的烟感',
          time: date
        }, {
          dev_property: 'powerstate',
          value: 'on',
          time: date
        }]
    };
  },
  components: { deviceDebug },
  activated() {
    this.activeCard = "deviceTotal";
  },
  methods: {
    formatTime(row, column) {
      return utils.timestampToTime(row.time);
    },
  },
};
</script>
<style>
  .bg-purple-dark {
    background: #f8f8f8;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
    text-align: center;
  }

 .prod-top {
    border: 1px solid #dcdfe6;
    border-radius: 5px;
    margin: 0;
    padding: 18px 21px;
 }
 
 .prod-detail-content {
   width: 29%;
   float: left;
 }
 
.prod-detail-content button {
  line-height: 25px;
  margin-left: 10px;
  color: #2dc6f6;
  background: white;
  cursor: pointer;
}

.prod-detail-content .title, .prod-key-content .title,.prod-create-time-content .title,.prod-protocol-content .title{
  margin-bottom: 23px;
}

.prod-detail-content .title{
  margin-left: 10px;
}

.prod-detail-content .center, .prod-key-content .center,.prod-create-time-content .center,.prod-protocol-content .center{
  text-align: center;
}
 
 .prod-type {
    float: left;
    height: 25px;
    line-height: 25px;
    background: #2dc6f6;
    font-size: 12px;
    padding: 0px 5px;
    border-radius: 5px;
    background-color: rgba(45,198,246,.1);
    border: 1px solid rgba(45,198,246,.2);
    color: #2dc6f6;
    margin-left: 10px;
 }

 .prod-key-content {
   width: 30%;
   float: left;
   border-left: 1px dashed #dcdfe6;
 }

  .prod-create-time-content {
   width: 20%;
   float: left;
   border-left: 1px dashed #dcdfe6;
 }

 .prod-protocol-content {
   width: 20%;
   float: left;
   border-left: 1px dashed #dcdfe6;
 }

 .prod-content {
   font-weight: bold;
 }

 .prod-center {
  border: 1px solid #dcdfe6;
  border-radius: 5px;
  margin: 0;
  padding: 18px 21px;
  width: 31%;
  margin-top: 30px;
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
 }

 .prod-total-content{
   width: 49%;
   float: left;
 }
  .prod-online-content{
   width: 49%;
   float: left;
   border-left: 1px dashed #dcdfe6;
 }

  .prod-total-content .center, .prod-online-content .center{ 
    margin: 0 auto;
    display: block;
    margin-bottom: 17px;
    text-align: center;
  }


.not-found {
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

 .not-found .code {
    color: rgba(0, 0, 0, 0.85);
    font-size: 24px;
    line-height: 1.8;
    text-align: center;
    margin-top: 16px;
  }
 .not-found .desc {
    color: rgba(0, 0, 0, 0.45);
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
  }
.el-pagination {
    text-align: center;
    margin-top: 30px;
  }
  .el-message-box__btns .cancel {
    float: right;
    margin-left: 10px;
  }

  .el-col-2 {
    height: 1px;
  }

  .product-type {
      width: 20%;
      float: left;
      line-height: 39px;
      text-align: left;
      font-weight: bold;
  }
  .product-type-sd {
      width: 80%;
      float: left;
  }

  .param-value {
    font-weight: bold;
    font-size: 20px;
  }
</style>